﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace A2DFramework.AssemblyService
{
    public static class AttributeUtils
    {
        public static T GetAttribute<T>(Type type)
            where T:Attribute
        {
            object[] attrs = type.GetCustomAttributes(typeof(T), false);
            if (attrs == null || attrs.Count() <= 0)
                return null;

            T attr = attrs[0] as T;
            if (attr == null)
                return null;

            return attr;
        }
    }
}
